import {defineStore} from "pinia";
import {ref} from "vue";

/**
 * 保存用户名和令牌
 * @type {StoreDefinition<"userStore", _ExtractStateFromSetupStore<{name: Ref<UnwrapRef<string>, UnwrapRef<string> | string>, token: Ref<UnwrapRef<string>, UnwrapRef<string> | string>, setName: function(*): void, setToken: function(*): void}>, _ExtractGettersFromSetupStore<{name: Ref<UnwrapRef<string>, UnwrapRef<string> | string>, token: Ref<UnwrapRef<string>, UnwrapRef<string> | string>, setName: function(*): void, setToken: function(*): void}>, _ExtractActionsFromSetupStore<{name: Ref<UnwrapRef<string>, UnwrapRef<string> | string>, token: Ref<UnwrapRef<string>, UnwrapRef<string> | string>, setName: function(*): void, setToken: function(*): void}>>}
 */
export const useUserStore = defineStore('userStore', ()=>{
    const name=ref("name")
    const token=ref("token")
    const setName=(param)=>{
        name.value=param
    }
    const setToken=(param)=>{
        token.value=param
    }
    return {name,token,setName,setToken}
})